import { get, post } from './http';
// 例子
// export const over_left_view1 = p => get('over_left_view/1', p);

// 总览左
const over_left_view_data = {}
export const over_left_view1 = p => post('/uapi/347362709840334848', {});
export const over_left_view2 = p => post('/uapi/357120873980760064', { "346342149714874368": {} });
export const over_left_view3 = p => post('/uapi/357181805775818752', { "344500672038703104": { "接口标题": "值班人员（3.1）" } });
export const over_left_view5 = p => post('/uapi/357183285438189568', { "346341575518851072": { "接口标题": "人员详情（3.2）" } });
export const over_left_view4 = p => post('/uapi/357114425074782208', { "344500872136364032": {} });
// 总览右
export const over_right_view1 = p => post('/uapi/357192694813954048', {});
export const over_right_view2 = p => post('/uapi/357193337758814208', {});
export const over_right_view3 = p => post('/uapi/357193641732608000', {});
let js_createTime = getMonthStartEnd().endDate
let ks_createTime = getMonthStartEnd().startDate
// let js_createTime = "2025-04-30"
// let ks_createTime = "2025-03-30"
export const over_right_view4 = p => post('/uapi/419108358134435840', {
    "392700862348136448": {
        "js_createTime": js_createTime,
        "ks_createTime": ks_createTime
    }
});

// 人员定位---------------------------------------------------------------
export const personal_left = p => post('/uapi/370895886714146816', {});
export const personal_right = p => post('/uapi/370896032675926016', {});
// 3D综合---------------------------------------------------------------
export const threeD_left1 = p => post('/uapi/370609947618054144', {});
export const threeD_left2 = p => post('/uapi/370608631906832384', {});
export const threeD_left3 = p => post('/uapi/370587515431686144', {});
export const threeD_left4 = p => post('/uapi/421970994601660416', {});//取气还气

export const threeD_right1 = p => post('/uapi/370882183788761088', {});
export const threeD_right2 = p => post('/uapi/370894789794598912', {
    "355746225074475008": {
        "handover_date": getPreviousDate()
    },
});
export const threeD_right3 = p => post('/uapi/370895127054389248', {});
// 车辆管理-----------------------------------------------------------
export const car_left = p => post('/uapi/370896386595491840', {});
export const car_right = p => post('/uapi/370896520100188160', {});
// 能源管理-----------------------------------------------------------
export const energy_left = p => post('/uapi/370896780751015936', {});
export const energy_right = p => post('/uapi/370896899953135616', {});
// 报警管理-----------------------------------------------------------
export const warn_left = p => post('/uapi/370897050318934016', {});
export const warn_right = p => post('/uapi/370897144426532864', {});
// 安全管理-----------------------------------------------------------
export const safe_left = p => post('/uapi/370897289432010752', {});
export const safe_right = p => post('/uapi/370897427181342720', {});
// 消防管理-----------------------------------------------------------
export const safex_left = p => post('/uapi/370897554776264704', {});
export const safex_right = p => post('/uapi/370897650658054144', {});

function getPreviousDate() {
    const date = new Date();
    date.setDate(date.getDate() - 1); // 减去一天
    const year = date.getFullYear();
    const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始，需+1
    const day = String(date.getDate()).padStart(2, '0');
    return `${year}-${month}-${day}`;
}
function getMonthStartEnd() {
    const now = new Date();

    // 获取当月第一天
    const start = new Date(now.getFullYear(), now.getMonth(), 1);

    // 获取当月最后一天（下个月第一天减1天）
    const end = new Date(now.getFullYear(), now.getMonth() + 1, 0);

    // 格式化日期为 yyyy-mm-dd
    const formatDate = (date) => {
        const year = date.getFullYear();
        const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始，需+1并补零
        const day = String(date.getDate()).padStart(2, '0');         // 日期补零
        return `${year}-${month}-${day}`;
    };

    return {
        startDate: formatDate(start),
        endDate: formatDate(end)
    };
}